#include <asm/apic.h>
#include <asm/io_apic.h>
#include <xen/iommu.h>
+#include <xen/pci.h>
static atomic_t waiting_for_crash_ipi;
static unsigned int crashing_cpu;
msecs--;
}
+ disconnect_pci_devices();
+
/* Crash shutdown any IOMMU functionality as the crashdump kernel is not
* happy when booting if interrupt/dma remapping is still enabled */
iommu_crash_shutdown();
return 0;
}
+/* Disconnect all PCI devices from the PCI buses. From the PCI spec:
+ * "When a 0 is written to [the COMMAND] register, the device is
+ * logically disconnected from the PCI bus for all accesses except
+ * configuration accesses. All devices are required to support
+ * this base level of functionality."
+ */
+void disconnect_pci_devices(void)
+{
+ struct pci_dev *pdev;
+
+ spin_lock(&pcidevs_lock);
+
+ list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
+ pci_conf_write16(pdev->bus, PCI_SLOT(pdev->devfn),
+ PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
+
+ spin_unlock(&pcidevs_lock);
+}
+
#ifdef SUPPORT_MSI_REMAPPING
static void dump_pci_devices(unsigned char ch)
{
struct pci_dev *pci_get_pdev(int bus, int devfn);
struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
+void disconnect_pci_devices(void);
+
uint8_t pci_conf_read8(
unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
uint16_t pci_conf_read16(